<template>
	<view>
		<h1>我的</h1>
		<view>
			<h1 style='color: red;'>{{ username ? '已登录' : '未登录' }}</h1>
		</view>
		<hr>
		<router-link url='/pages/index/index' ><h1>主页</h1></router-link>
		<hr>
		<button @click="logou" v-if="username">退出登录</button>
	</view>
</template>

<script>
	import routerLink from '@/components/routerLink.vue'
	import store from '@/store/index.js'
	export default {
		components:{
			routerLink
		},
		data() {
			return {
				username: null
			}
		},
		onLoad(option) {
			this.username = this.$store.getters.token
		},
		methods: {
			logou() {
				this.$store.commit('app/logout')
				this.$Routers({
					url: '/pages/login/login'
				})
			}
		}
	}
</script>

<style>

</style>
